import java.util.List;

public class LeeCode203DummyHead {

    public class ListNode {

        int val;
        ListNode next;

        ListNode(int x) {
            val = x;
        }
    }

    public class solution {

        public ListNode element(ListNode head, int val) {

            ListNode dummyHead=new ListNode(-1);
            dummyHead.next=head;
//            ListNode prev=dummyHead;

            while (dummyHead.next != null) {
                if (dummyHead.val == val) {
                    dummyHead.next = dummyHead.next.next;
                } else {
                    dummyHead = dummyHead.next;
                }
            }
            return dummyHead.next;
        }

    }


}
